package com.zzz.poker.feign;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @author <lt>
 * @since 2022-12-12 09:47
 */
@FeignClient(name = "wechat-service", url = "${weChat.miniProgram.url:https://api.weixin.qq.com}")
public interface WeChatFeignService {

    //小程序获取凭证接口
    @GetMapping(value = "/cgi-bin/token")
    String getAccessToken(
            @RequestParam(name = "appid", required = false) String appid,
            @RequestParam("secret") String secret,
            @RequestParam("grant_type") String grant_type
    );

    /**
     * 小程序获取不限制的小程序码接口
     * @param accessToken
     * @param createCodeDto
     * @return
     */
//    @PostMapping(value = "/wxa/getwxacodeunlimit")
//    Response createCode(
//            @RequestParam("access_token") String accessToken,
//            @RequestBody CreateCodeDto createCodeDto
//       );


    /**
     * 小程序登录接口
     * @param appid
     * @param secret
     * @param grant_type
     * @return
     */
    @GetMapping(value = "/sns/jscode2session")
    String jscode2session (
            @RequestParam("appid") String appid,
            @RequestParam("secret") String secret,
            @RequestParam("js_code") String js_code,
            @RequestParam("grant_type") String grant_type
    );
}
